package com.cheer.controller;

import com.cheer.common.Result;
import com.cheer.dto.MallAdminRegisterDTO;
import com.cheer.dto.PasswordUpdateDTO;
import com.cheer.service.MallAdminService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cheer
 */
@RestController
public class MallAdminController {

    @Autowired
    private MallAdminService mallAdminService;

    @ApiOperation("注册管理员，测试使用，非正式环境")
    @PostMapping("/register")
    public Result register(@RequestBody MallAdminRegisterDTO adminRegisterDTO){
        mallAdminService.add(adminRegisterDTO);
        return Result.success();
    }

    @ApiOperation("修改密码")
    @PostMapping("/password/update")
    public Result updatePassword(@RequestBody PasswordUpdateDTO passwordUpdateDTO){
        mallAdminService.updatePassword(passwordUpdateDTO);
        return Result.success();
    }
}
